package net.bsayiner.phoneTest;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView;
import android.widget.GridView;

public class MainScreenActivity extends Activity {

	private GridviewAdapter gridviewAdapter;
	private ArrayList<String> listTestNames;
	private ArrayList<Integer> listTestIcons;
	private GridView gridView;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.main_layout);
		prepareLists();
		gridviewAdapter = new GridviewAdapter(this, listTestNames, listTestIcons);
		gridView = (GridView) findViewById(R.id.gridView);
		gridView.setAdapter(gridviewAdapter);
		gridView.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
				switch (arg2) {
				case 0:
					Intent intent = new Intent(MainScreenActivity.this, ScreenTestActivity.class);
					startActivity(intent);
					break;
				}
			}
		});
	}

	private void prepareLists() {
		listTestNames = new ArrayList<String>();
		listTestNames.add("Screen");
		listTestNames.add("Camera");
		listTestNames.add("Battery");
		listTestNames.add("Accelometer");
		listTestNames.add("Gps");
		listTestNames.add("Keyboard");
		listTestNames.add("Memory");
		listTestNames.add("Microphone");
		listTestNames.add("Network");
		listTestNames.add("Orientation");
		listTestNames.add("Processor");
		listTestNames.add("Proximity");
		listTestNames.add("Sound");
		listTestNames.add("Touch");
		listTestNames.add("Vibrate");
		listTestNames.add("Summary");

		listTestIcons = new ArrayList<Integer>();
		listTestIcons.add(R.drawable.screen);
		listTestIcons.add(R.drawable.camera);
		listTestIcons.add(R.drawable.battery);
		listTestIcons.add(R.drawable.accelometer);
		listTestIcons.add(R.drawable.gps);
		listTestIcons.add(R.drawable.keyboard);
		listTestIcons.add(R.drawable.memory);
		listTestIcons.add(R.drawable.microphone);
		listTestIcons.add(R.drawable.network);
		listTestIcons.add(R.drawable.oriantation);
		listTestIcons.add(R.drawable.processor);
		listTestIcons.add(R.drawable.proximity);
		listTestIcons.add(R.drawable.sound);
		listTestIcons.add(R.drawable.touch);
		listTestIcons.add(R.drawable.vibrate);
		listTestIcons.add(R.drawable.summary);
	}

}